
var today = new Date();

console.warn(today);

var dayOfWeek = today.getDay(); // 返回星期几，用0-6表示，0是星期天

var day = today.getDate();
var month = today.getMonth() + 1; // 返回月份，0-11
var year = today.getFullYear();
console.warn("%d-%d-%d", year, month, day);

var hours = today.getHours();
var minutes = today.getMinutes();
var seconds = today.getSeconds();

console.warn("%d:%d:%d", hours, minutes, seconds);